<?php
session_start();
if (!isset($_SESSION['logueado']) || $_SESSION['logueado'] == null) {
    include_once("dialog_login.php");
} else {
    $user_id = $_SESSION['user_id'];

    header("Content-Type: text/html; charset=utf-8");

    $jsonurl = "http://nibble.li/twittertido/web/getUser.php?id=$user_id";
    $json = file_get_contents($jsonurl, 0, null, null);
    $json_output = json_decode($json, true);
    $arrays = $json_output['users'];
    $user = $arrays[0];
    ?>
    <!DOCTYPE html>
    <html> 
        <head>
            <meta charset="utf-8">
            <meta name="viewport" content="width=device-width, initial-scale=1"> 
            <title>Perfil</title> 
            <link rel="stylesheet"  href="//code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
        </head> 
        <body> 

            <div data-role="page">

                <div data-role="header" data-theme="d">
                    <h1><?php print $user['username']; ?>$_SESSION['logueado']</h1>

                </div>

                <div data-role="content" data-theme="c" style="text-align: center">
                    <ul data-role="listview" data-inset="true" >
                        <li data-role="list-divider">Informaci&oacute;n Twittertido</li>
                        <li><a href="index.html">Enviados <span class="ui-li-count"><?php print $user['send']; ?></span></a></li>
                        <li><a href="index.html">Publicados <span class="ui-li-count"><?php print $user['published']; ?></span></a></li>
                    </ul>

                    <ul data-role="listview" data-inset="true">
                        <li data-role="list-divider">Informaci&oacute;n del usuario</li>
                        <li>
                            <h3>Nombre de usuario</h3>
                            <p><?php print $user['username']; ?></p>
                        </li>
                        <li>
                            <h3>Email</h3>
                            <p><?php print $user['email']; ?></p>
                        </li>
                        <li>
                            <h3>Nivel del usuario</h3>
                            <p><?php print $user['level_id']; ?></p>
                        </li>
                        <li>
                            <h3>Fecha de creaci&oacute;n</h3>
                            <p><?php print $user['date']; ?></p>
                        </li>
                    </ul>
                    <a href="utils.php?action=logout" rel="external" data-role="button">Cerrar sesi&oacute;n</a>
                </div>
            </div>
        </body>
    </html>
<?php } ?>